package cn.t.web.ent;

import cn.t.core.mode.PageInfoDTO;
import cn.t.core.mode.PageQueryDTO;
import cn.t.dto.user.CustomerFirmDTO;
import cn.t.facade.sku.SkuFacade;
import cn.t.facade.user.CustomerFirmFacade;
import cn.t.request.SkuReq;
import cn.t.vo.ent.EntAbbSkuVO;
import cn.t.vo.sku.SkuVo;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 企业站-商品管理
 */
@Slf4j
@RestController
@RequestMapping("/ent")
@AllArgsConstructor
public class EntSkuController {

    private final SkuFacade facade;
    private final CustomerFirmFacade customerFirmFacade;

    /**
     * 商品列表分页查询接口
     */
    @PostMapping(value = "/sku/page")
    public PageInfoDTO<SkuVo> findSkuByPage(@RequestBody PageQueryDTO<SkuReq> req) {return facade.findSkuByPage(req);}

    /**
     * 根据客户号查询公司
     */
    @GetMapping(value = "/queryFirmByCode")
    public CustomerFirmDTO queryFirmByCode(@RequestParam String customerCode) {return customerFirmFacade.queryFirmByCode(customerCode);}

    /**
     * 企业站小程序-ABB上架商品查询
     */
    @GetMapping(value = "/sku/abb")
    public List<EntAbbSkuVO> getAbbSku(@RequestParam Long firmId) {
        return facade.getAbbSku(firmId);
    }

}

